package models;

import play.*;
import play.db.jpa.*;

import javax.persistence.*;

import org.joda.time.DateTime;

import java.util.*;

@Entity
public class Order_item extends Model {
	
	@OneToOne
	public Dish dish;
	
    public int qty;
    public double totalPrice;
	public Order_item(Dish dish, int qty) {
		super();
		this.dish = dish;
		this.qty = qty;

	}
	
	@Override
	public String toString() {
		return "Order_item [dish=" + dish + ", qty=" + qty + "]";
	}
	
	public void calculatePrice(){
		this.totalPrice = this.dish.price * this.qty;
	}
}
